package com.bops.web.controller;

import java.util.List;
import java.util.Map;

import com.bops.dal.product.dataobject.ProductsDO;
import com.bops.dal.product.queryobject.ProductsQuery;
import com.bops.service.CommonServiceLocator;
import com.bops.service.ProductService;
import com.yue.commons.seine.web.annotations.ControllerAction;
import com.yue.commons.seine.web.servlet.mvc.AbstractController;
import com.yue.commons.seine.web.servlet.result.View;
import com.yue.commons.seine.web.servlet.result.WebResult;

public class AdminController extends AbstractController {

	
	private ProductService productService = CommonServiceLocator.getProductService();
    @ControllerAction
    public WebResult bug(Map<String, Object> model) {
        return new View("/admin/bug.htm");
    }
    
    @ControllerAction
    public WebResult error(Map<String, Object> model) {
        return new View("/admin/error.htm");
    }
    
    @ControllerAction
    public WebResult index(Map<String, Object> model) {
    	ProductsQuery queryProduct = new ProductsQuery();
    	queryProduct.setPageSize(Integer.MAX_VALUE);
    	List<ProductsDO> productList = productService.listProduct(queryProduct);
    	if(productList.size() >0 || productList !=null){
        	model.put("productList", productList);
    	}
    	
        return new View("/index.htm");
    }
    
    @ControllerAction
    public WebResult join(Map<String, Object> model) {
        return new View("/join.htm");
    }
    
    
}